package com.seekting.study;

public class TestBack {

    public static void main(String[] args) {

        float begin = 0;
        float end = 0f;
        float min = Integer.MAX_VALUE;
        float max = Integer.MIN_VALUE;
        for (int i = 0; i < 100; i++) {
            float in = i * 0.01f;
            end = getZuni(in);
            if (i == 0) {
                begin = end;
            }

            min = Math.min(min, end);
            max = Math.max(max, end);
            System.out.println(end);

        }
        System.out.println("xxx" + (max - min));

        double e = Math.pow(3, 0);
        System.out.println("e" + e);

        double cos = Math.cos(Math.PI / 2);

    }

    public static float getZuni(float t) {
        float b = 200f, c = -200f, d = 1, a = 0, p = 0;
        float s = 0;
        if (t == 0) {
            return b;
        }
        if ((t /= d) == 1) {
            return b + c;
        }
        if (p != 0) {
            p = d * 0.3f;
        }
        if (a != 0 || a < Math.abs(c)) {
            a = c;
            s = p / 4;
        }
        else {
            s = (float) (p / (2 * Math.PI) * Math.asin(c / a));
        }
        return (float) (a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b);
    }

    public static float getZuni1(float t) {

        float A = 1.8f;
        float w = (float) (Math.PI * 2f) + 0.5f;
        float s = (float) (Math.PI / 2) + 0.3f;
        float y = 0;
        double xx = Math.pow(Math.E, -s * t);
        double y1 = A * xx;
        double y2 = Math.cos(w * t + s);
        y = -(float) (y1 * y2);
        return y;
    }
}
